package com.hu.zhcc.shiro.controller.lww.member;


import com.hu.zhcc.shiro.entity.lww.member.MemberDy;
import com.hu.zhcc.shiro.entity.lww.member.TMemberDynamicinfo;
import com.hu.zhcc.shiro.service.lww.member.TMemberDynamicinfoService;
import com.hu.zhcc.shiro.service.lww.member.TMemberExaminationService;
import com.hu.zhcc.shiro.service.lww.member.TMemberService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;



/**
 * <p>
 * 会员动态信息表 前端控制器
 * </p>
 *
 * @author luowuwen
 * @since 2021-06-15
 */
@RestController
public class TMemberDynamicinfoController {


    @Autowired
    private TMemberDynamicinfoService service;

    @Autowired
    private TMemberService ser;

    @Autowired
    private TMemberExaminationService examinationService;

    @PostMapping("insertDynamicinfoByid")
    public boolean insertDynamicinfo(@RequestBody TMemberDynamicinfo tMemberDynamicinfo){
            examinationService.uodateStatus(tMemberDynamicinfo.getTMemberId());
            examinationService.updateStatusByorder(tMemberDynamicinfo.getTMemberId());
        return service.insertTMemberDynamicinfo(tMemberDynamicinfo);
    }

    @PostMapping("queryDynamicinfoByid")
    public MemberDy queryDynamicinfoByid(int id){
        MemberDy memberDy = ser.selectDynamicinfoByid(id);
        System.out.println(memberDy);
        return memberDy;
    }

    @PostMapping("queryDynamicinfo")
    public TMemberDynamicinfo selecid(int id){
            return service.selectDynamicinfo(id);
    }

    @PostMapping("updateDynamicinfo")
    public boolean updateDynamicinfo(@RequestBody TMemberDynamicinfo dynamicinfo){
        return service.updateTMemberDynamicinfoByid(dynamicinfo);
    }

    @PostMapping("updateDynamicinfoever")
    public boolean updateDynamicinfoever(@RequestBody TMemberDynamicinfo dynamicinfo){
        examinationService.uodateStatus(dynamicinfo.getTMemberId());
        return service.updateTMemberDynamicinfoByid(dynamicinfo);
    }
}

